home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Time Bonus.lua < prev    next >
Text File  |  2010-07-27  |  2KB  |  58 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Time Bonus
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, August 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.timebonus={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.timebonus.gfx_wpn=loadgfx("weapons/timebonus.png")                        -- Weapon Image
  13. setmidhandle(cc.timebonus.gfx_wpn)
  14. cc.timebonus.sfx_heal=loadsfx("timebonus.ogg")
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Time Bonus
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.timebonus.id=addweapon("cc.timebonus","Time Bonus",cc.timebonus.gfx_wpn,1,2)    -- Add Weapon (1 use, first in round 2)
  21.  
  22. function cc.timebonus.draw()                                                -- Draw
  23.     -- Do nothing!
  24. end
  25.  
  26. function cc.timebonus.attack(attack)                                        -- Attack
  27.     if (weapon_shots<=0) then
  28.         if (attack==1) then
  29.             -- Use weapon and allow to use another one afterwards (1)
  30.             useweapon(1)
  31.             weapon_shots=weapon_shots+1
  32.             -- Time Bonus
  33.             changeturntime(20)
  34.             -- Effect
  35.             playsound(cc.timebonus.sfx_heal)
  36.             x=getplayerx(0)
  37.             y=getplayery(0)+3
  38.             particle(p_muzzle,x,y)
  39.             particlesize(1,1)
  40.             particlecolor(255,255,0)
  41.             particlealpha(1.0)
  42.             particlefadealpha(0.01)
  43.             particle(p_muzzle,x,y)
  44.             particlesize(1,2)
  45.             particlecolor(255,255,0)
  46.             particlealpha(1.0)
  47.             particlefadealpha(0.02)
  48.             particlerotation(0)
  49.             for j=1,15,1 do
  50.                 particle(p_flare,x-10.0+math.random()*20.0,y+math.random()*10.0)
  51.                 particlesize(3.0,3.0)
  52.                 particlecolor(255,255,0)
  53.                 particlespeed(0,math.random(2,15)*-0.1)
  54.                 particlefadealpha(0.01)
  55.             end
  56.         end
  57.     end
  58. end